import base64
import os
fpath = os.listdir()
for i in fpath:
    if os.path.isdir(i):
        pass
    elif os.path.splitext(i)[1] == '.h':
        print(i,end=' ==> ')
        wjm = os.path.splitext(i)[0]# 文件名
        jiami = open(i,'r')
        wjkz = jiami.readline().split()[0]# 文件扩展
        a = open('%s%s'%(wjm,wjkz),'wb')
        a.close()
        a = open('%s%s'%(wjm,wjkz),'ab')
        for letters in jiami.readlines():
            e = base64.b64decode(letters.encode())
            a.write(e)
        jiami.close()
        a.close()
        os.remove(i)
        print('%s%s'%(wjm,wjkz))

